package com.meituan.service.impl;

import com.meituan.mapper.EvaluateMapper;
import com.meituan.mapper.ReplyMapper;
import com.meituan.model.ReplyEntity;
import com.meituan.service.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

@Service
@Transactional
public class ReplyServiceImpl implements ReplyService {
    @Autowired
    ReplyMapper replyMapper;
    @Autowired
    EvaluateMapper evaluateMapper;
    @Override
    public Integer add(ReplyEntity replyEntity) {
        Integer result = replyMapper.Insert(replyEntity);
        if(result==1){
            return evaluateMapper.updateReply(String.valueOf(replyEntity.getReplyId()),String.valueOf(replyEntity.getEvaluationId()));
        }
        return 0;
    }
}
